<include file='Admin/Tpl/Public/nav.html' />
<div class="page-content">
    <div class="container-fluid">
        <br/>
        <ol class="breadcrumb default square rsaquo sm">
            <li><a href="index.html"><i class="fa fa-home"></i></a></li>
            <li><a href="#fakelink">Teamin</a></li>
            <li class="active"> 问题管理 </li>
        </ol>
        
        <div class="the-box no-border">
            <div class="table-responsive div1 div_search">
                <table class="table table-th-block table-hover">
                    <thead>
                    <tr style="text-align:center">
                        <td style="text-align:center;width:60px">编号</td>
                        <td style="text-align:center">主题名称</td>
                        <td style="text-align:center;width:60px">问题</td>
                        <td style="text-align:center;width:60px">参与</td>
                        <td style="text-align:center;width:70px">状态</td>
                        <td style="text-align:center;width:180px">结束时间</td>
                        <td style="text-align:center;width:120px">更改状态</td>
                        <td style="text-align:center;width:220px">操作</td>
                    </tr>
                    </thead>
                    <tbody>
                    <volist name="rs.data" id="val">
                        <tr>
                            <td style='text-align:center;vertical-align:middle'>{$val.questionnaire_id}</td>
                            <td style='text-align:center;vertical-align:middle'>{$val.questionnaire_title}</td>
                            <td style='text-align:center;vertical-align:middle'>{$val.questionnaire_question_num}</td>
                            <td style='text-align:center;vertical-align:middle'>{$val.questionnaire_audience_num}</td>
                            <td class="{$val.bg_color}" style='text-align:center;vertical-align:middle; color:black'>{$val.questionnaire_state}</td>
                            <td style='text-align:center;vertical-align:middle'>{$val.questionnaire_end_time|date="Y-m-d H:i",###}</td>
                            <td style='text-align:center;vertical-align:middle'><a href='javascript:void(0)' onclick="update_state({$val.questionnaire_state_1},{$val.questionnaire_id},{$val.questionnaire_question_num})" title='Edit'>{$val.questionnaire_state_1_1}</a></td>
                            <td style='text-align:center;vertical-align:middle'>
                                <a href='__URL__/to_add_question?questionnaire_id={$val.questionnaire_id}' title='Edit'>题目管理</a>&nbsp;|&nbsp;
                                <a href='javascript:void(0)' onclick="uptAct({$val.questionnaire_id})" title='Edit'>修改</a>&nbsp;|&nbsp;
                                <a href='javascript:void(0)' onclick='delAct({$val.questionnaire_id})' title='Delete'>删除</a>
                            </td>
                        </tr>
                    </volist>
                    </tbody>
                </table>
                <ul class="pagination success">{$rs.show}</ul>
            </div>
            <div class="table-responsive" id="hl"></div>
        </div>
    </div>
</div>
</div>
</body>
</html>
<script>
function delAct(a){
	if(confirm('确认删除?')){
		$.get(
			'__URL__/delAct?questionnaire_id='+a,
			function(){	window.location='__SELF__';},'json');
	}
}
function uptAct(a){
    window.location='__URL__/to_update?questionnaire_id='+a;
}
function update_state($state,$questionnaire_id,$question_num)
{
	if($question_num == 0){
		alert('当前的问题数为0,请先添加问题');
		return false;
	}
	if(confirm('确认修改?')){
		$.get(
			'__URL__/update_state?questionnaire_state='+$state+'&questionnaire_id='+$questionnaire_id,
			function(data){
				if(data.state == 0)
					window.location='__SELF__';
				else
					alert('修改失败');
			},'json');
	}	
}

$(".city").click(function(){
	var local_id =$(this).attr("name");
	var local_name = $(this).text();
	$(".city_check").attr({"name":local_id});
	$(".city_check").text(local_name);
	var param ={
		category_id:$(this).attr('name'),
	}
	window.location = '__URL__/meeting_list?category_id='+local_id;
});

if('<php>echo $_GET["category_id"]</php>'!=''){
	$(".city").each(function(index, element) {
		if($(this).attr('name')=='<php>echo $_GET["category_id"]</php>'){
			var local_id =$(this).attr("name");
			var local_name = $(this).text();
			$(".city_check").attr({"name":local_id});
			$(".city_check").text(local_name);
		}
	});
}
</script>
